{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "0327196d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "finished!\n"
     ]
    }
   ],
   "source": [
    "from mindspore import context\n",
    "from mindspore import ops as ops\n",
    "import numpy as np\n",
    "import mindspore\n",
    "\n",
    "\n",
    "# context.set_context(mode=context.PYNATIVE_MODE, device_target=\"Ascend\")\n",
    "context.set_context(mode=context.GRAPH_MODE, device_target=\"Ascend\")\n",
    "idx = np.random.randint(0, 1024, (1024, 8))\n",
    "idx = mindspore.Tensor(idx, mindspore.int32)\n",
    "\n",
    "# pts_n_16 = np.random.randint(0, 1024, (1024, 16))\n",
    "# pts_n_16 = mindspore.Tensor(pts_n_16, mindspore.float32)\n",
    "# pts_i_16 = pts_n_16[idx, :]\n",
    "\n",
    "pts_n_3 = np.random.random((1024, 3))\n",
    "pts_n_3 = mindspore.Tensor(pts_n_3, mindspore.float32)\n",
    "pts_i_3 = pts_n_3[idx, :]\n",
    "print(\"finished!\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "919720c0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Tensor(shape=[1024, 8, 3], dtype=Float32, value=\n",
       "[[[ 3.41322660e-01,  9.74269390e-01,  9.81192946e-01],\n",
       "  [ 7.42397487e-01,  2.79571176e-01,  5.21378219e-01],\n",
       "  [ 5.35279393e-01,  9.10035968e-01,  8.30814600e-01],\n",
       "  ...\n",
       "  [ 6.66577160e-01,  7.32808590e-01,  4.26168591e-01],\n",
       "  [ 9.09947991e-01,  5.55359960e-01,  4.78835821e-01],\n",
       "  [ 4.98276204e-02,  7.08787501e-01,  1.37961477e-01]],\n",
       " [[ 4.68628198e-01,  9.36640024e-01,  5.80425680e-01],\n",
       "  [ 6.81132674e-01,  9.95654166e-01,  7.85213138e-04],\n",
       "  [ 9.52453554e-01,  8.18199992e-01,  2.98710495e-01],\n",
       "  ...\n",
       "  [ 8.09889212e-02,  9.19015259e-02,  1.32521331e-01],\n",
       "  [ 4.66917276e-01,  8.56073499e-01,  8.82031083e-01],\n",
       "  [ 1.93472639e-01,  7.84925044e-01,  3.64895135e-01]],\n",
       " [[ 6.61111295e-01,  6.43363535e-01,  1.02314644e-01],\n",
       "  [ 8.85880113e-01,  9.17969584e-01,  4.79965180e-01],\n",
       "  [ 8.47119868e-01,  8.59855771e-01,  6.60567045e-01],\n",
       "  ...\n",
       "  [ 9.63770688e-01,  9.58994865e-01,  3.39608610e-01],\n",
       "  [ 6.75605118e-01,  6.27441883e-01,  2.98542790e-02],\n",
       "  [ 7.50873625e-01,  7.92491436e-01,  8.22289407e-01]],\n",
       " ...\n",
       " [[ 3.30248296e-01,  7.35018134e-01,  3.28929454e-01],\n",
       "  [ 5.56996524e-01,  8.02747607e-01,  2.73347646e-01],\n",
       "  [ 7.99597681e-01,  6.43149793e-01,  5.51474094e-01],\n",
       "  ...\n",
       "  [ 4.50885147e-01,  8.63377079e-02,  5.01642168e-01],\n",
       "  [ 1.78640485e-02,  2.23585725e-01,  2.78089106e-01],\n",
       "  [ 5.15468776e-01,  5.04613340e-01,  1.73487321e-01]],\n",
       " [[ 4.69002813e-01,  2.31220070e-02,  4.33280945e-01],\n",
       "  [ 8.97878110e-01,  8.44837964e-01,  3.51363212e-01],\n",
       "  [ 3.18196237e-01,  7.95270741e-01,  5.93476832e-01],\n",
       "  ...\n",
       "  [ 5.60141087e-01,  3.20250601e-01,  9.18432236e-01],\n",
       "  [ 3.28616410e-01,  8.22386682e-01,  5.79301603e-02],\n",
       "  [ 1.02766156e-01,  2.40199924e-01,  9.44023430e-01]],\n",
       " [[ 4.28681076e-01,  5.24341203e-02,  9.53319907e-01],\n",
       "  [ 7.09612131e-01,  5.46898879e-02,  6.47501469e-01],\n",
       "  [ 5.57735085e-01,  8.55168343e-01,  2.43958443e-01],\n",
       "  ...\n",
       "  [ 6.03112638e-01,  3.68121147e-01,  5.20826340e-01],\n",
       "  [ 9.39307153e-01,  2.47805402e-01,  8.90064955e-01],\n",
       "  [ 8.36797208e-02,  8.34364474e-01,  1.97782233e-01]]])"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pts_i_3\n",
    "# pts_i_16"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f701ba6b",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "55e5b4d7",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "MindSpore",
   "language": "python",
   "name": "mindspore"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
